'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { STRING, DATE, BOOLEAN, INTEGER } = Sequelize;
    await queryInterface.createTable("sys_role", {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment: "主键id，自增",
      },
      roleName: {
        type: STRING(32),
        unique: true,
        allowNull: false,
        comment: "角色名称",
      },
      roleKey: {
        type: STRING(50),
        unique: true,
        allowNull: false,
        comment: "角色标识",
      },
      status: {
        type: BOOLEAN,
        defaultValue: true,
        comment: "状态 true：有效  false：冻结",
      },
      createById: {
        type: STRING(36),
        comment: "创建人ID",
      },
      createTime: {
        type: DATE,
        comment: "创建时间",
      },
      updateById: {
        type: STRING(36),
        comment: "更新人Id",
      },
      updateTime: {
        type: DATE,
        comment: "更新时间",
      },
      delFlag: {
        type: BOOLEAN,
        defaultValue: false,
        comment: "状态 true：已删  false：未删",
      },
    })
  },

  down: async (queryInterface) => {
    await queryInterface.dropTable("sys_role");
  },
};
